package com.sservice.service.service.impl;


import com.sservice.model.dao.OrderShopMapper;
import com.sservice.model.entity.OrderShop;
import com.sservice.service.service.OrderShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by suweiming on 2018/10/23.
 */
@Service
public class OrderShipServiceImpl implements OrderShopService {

    @Autowired
    OrderShopMapper orderShopMapper;

    @Override
    public OrderShop findById(int id) {
        return orderShopMapper.selectByPrimaryKey(id);
    }

    @Override
    public int update(OrderShop orderShop) {
        return orderShopMapper.updateByPrimaryKeySelective(orderShop);
    }

    @Override
    public int addBatch(List<OrderShop> list) {
        return orderShopMapper.addBatch(list);
    }

    @Override
    public OrderShop getOrderShopOneBy(OrderShop record) {
        return orderShopMapper.getOrderShopBy(record).get(0);
    }

    @Override
    public int removeById(int id) {
        return orderShopMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateNum(int id, double number) {
        OrderShop orderShop = new OrderShop();
        orderShop.setId(id);
        orderShop.setNumber(number);
        return orderShopMapper.updateByPrimaryKeySelective(orderShop);
    }

    @Override
    public List<OrderShop> getOrderShopBy(OrderShop record) {
        return orderShopMapper.getOrderShopBy(record);
    }

    //

}
